<?php if(!defined("HDPHP_PATH"))exit;C("SHOW_NOTICE",FALSE);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<!-- basic styles -->
	<link href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/common.css" rel="stylesheet" />
	<link href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/bootstrap.min.css" rel="stylesheet" />
	<link href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/bootstrap-responsive.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/font-awesome.min.css" />
	<!--[if IE 7]>
	  <link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/font-awesome-ie7.min.css" />
	<![endif]-->
	<!-- page specific plugin styles -->
	<script type='text/javascript' src='http://localhost/qm_shop/hdphp/hdphp/../hdjs/jquery-1.8.2.min.js'></script>
<link href='http://localhost/qm_shop/hdphp/hdphp/../hdjs/css/hdjs.css' rel='stylesheet' media='screen'>
<script src='http://localhost/qm_shop/hdphp/hdphp/../hdjs/js/hdjs.js'></script>
<script src='http://localhost/qm_shop/hdphp/hdphp/../hdjs/js/slide.js'></script>
<script src='http://localhost/qm_shop/hdphp/hdphp/../hdjs/org/cal/lhgcalendar.min.js'></script>
<script type='text/javascript'>
		HOST = 'http://localhost';
		ROOT = 'http://localhost/qm_shop';
		WEB = 'http://localhost/qm_shop/index.php';
		URL = 'http://localhost/qm_shop/index.php/Admin/Goods/add_good_attr/gid/28/tid/1';
		HDPHP = 'http://localhost/qm_shop/hdphp/hdphp';
		HDPHPDATA = 'http://localhost/qm_shop/hdphp/hdphp/Data';
		HDPHPTPL = 'http://localhost/qm_shop/hdphp/hdphp/Lib/Tpl';
		HDPHPEXTEND = 'http://localhost/qm_shop/hdphp/hdphp/Extend';
		APP = 'http://localhost/qm_shop/index.php/Admin';
		CONTROL = 'http://localhost/qm_shop/index.php/Admin/Goods';
		METH = 'http://localhost/qm_shop/index.php/Admin/Goods/add_good_attr';
		GROUP = 'http://localhost/qm_shop/./Qmshop';
		TPL = 'http://localhost/qm_shop/./Qmshop/App/Admin/Tpl';
		CONTROLTPL = 'http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Goods';
		STATIC = 'http://localhost/qm_shop/Static';
		PUBLIC = 'http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public';
		HISTORY = 'http://localhost/qm_shop/index.php/Admin/Goods/index';
		HTTPREFERER = 'http://localhost/qm_shop/index.php/Admin/Goods/index';
</script>
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/jquery-ui-1.10.2.custom.min.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/chosen.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/datepicker.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/bootstrap-timepicker.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/daterangepicker.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/colorpicker.css" />
	<!-- ace styles -->
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/ace.min.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/ace-responsive.min.css" />
	<link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/ace-skins.min.css" />
	<style type="text/css">
		select, textarea, input[type="text"], input[type="password"], input[type="datetime"], input[type="datetime-local"], input[type="date"], input[type="month"], input[type="time"], input[type="week"], input[type="number"], input[type="email"], input[type="url"], input[type="search"], input[type="tel"], input[type="color"], .uneditable-input {
	    margin-bottom: 0px;
	}
	</style>
	<!--[if lt IE 9]>
	  <link rel="stylesheet" href="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/css/ace-ie.min.css" />
	<![endif]-->
	<title>货品列表</title>
</head>
<body>
<div class="container-fluid" id="main-container">
		<!-- PAGE CONTENT BEGINS HERE -->
		<div class="table-header">
			商品管理 | <a style="font-size:14px;" href="<?php echo U('Goods/index');?>">商品列表</a> > <a style="font-size:14px;" href="">货品列表</a>
		</div>
		<div class="row-fluid">
			<div class="span12">
				<div class="row-fluid" style="background-color: #EFF3F8;padding: 8px 10px;">
					<div class="fl font14">
						当前商品：<?php echo $name;?>
					</div>
					<div class="fr" style="margin-right:50px;">
						<span class="font14" style='margin-right:15px;'>当前类型：[<?php echo $type;?>]</span>
						<span class="font14">总库存：[<span class="font14" style="color:red"><?php echo $nums;?></span>]</span>
					</div>
				</div>
				<table id="table_bug_report" class="table table-striped table-bordered table-hover">
					<thead>
						<tr>
							<th style="width:100px;">BID</th>
							<?php if(is_array($attrName)):?><?php  foreach($attrName as $value){ ?>
								<th><?php echo $value['aname'];?></th>
							<?php }?><?php endif;?>
							<th class="hidden-phone" style="width:200px;"><i class="icon-inbox hidden-phone"></i> 库存</th>
							<th style="width:200px;">操作</th>
						</tr>
					</thead>							
					<tbody>
						<?php if(is_array($combine)):?><?php  foreach($combine as $v){ ?>
							<tr>
								<td style="width:100px;"><?php echo $v['bid'];?></td>
								<?php if(is_array($v['bcontent'])):?><?php  foreach($v['bcontent'] as $value){ ?>
									<td><?php echo $value;?></td>
								<?php }?><?php endif;?>
								<td class="hidden-phone" style="width:200px;">
									<form action="<?php echo U('Goods/ajax_edit_attr');?>" onsubmit="return hd_submit(this,'http://localhost/qm_shop/index.php/Admin/Goods/add_good_attr/gid/28/tid/1')" style="margin:0px">
										<span><?php echo $v['binventory'];?></span>
										<input type="text" name="binventory" value="<?php echo $v['binventory'];?>" style="display:none;margin-bottom:0px"/>
										<input type="hidden" name="bid" value="<?php echo $v['bid'];?>">
									</form>
								</td>
								<td style="width:200px;">
									<a href="javascript:" class="btn btn-mini btn-success tooltip-success edit-combine" data-rel="tooltip" data-placement="left"><i class="icon-edit">修改</i></a>
									<a href="javascript:" class="btn btn-mini btn-danger tooltip-error" data-rel="tooltip" data-placement="left" onclick="if(confirm('确定要删除吗？')) hd_ajax('<?php echo U('ajax_del_attr',array('bid'=>$v['bid']));?>')"><i class="icon-trash">删除</i></a>
								</td>
							</tr>
						<?php }?><?php endif;?>
						<tr>
							<form action="<?php echo U('Goods/ajax_add_attr');?>" name="combine-form" onsubmit="return hd_submit(this,'http://localhost/qm_shop/index.php/Admin/Goods/add_good_attr/gid/28/tid/1')">
								<td style="width:100px;">添加货品</td>
								<?php if(is_array($attrName)):?><?php  foreach($attrName as $value){ ?>
									<td><select id="form-field-select-1" name="bcontent[]">
											<option class="Types">请选择<?php echo $value['aname'];?>值</option>
											<?php if(is_array($attr)):?><?php  foreach($attr as $v){ ?>
												<?php if($v['aname']==$value['aname']){?>
													<option value="<?php echo $v['aid'];?>" class="Types"><?php echo $v['acontent'];?></option>
												<?php }?>
											<?php }?><?php endif;?>
										</select>
									</td>
								<?php }?><?php endif;?>
								<td style="width:200px;"><input type="text" style="width:150px;margin-bottom:0px" name="binventory" placeholder="请填入库存数"/></td>
								<td style="width:200px;">
									<input type="hidden" name="qm_goods_gid" value="<?php echo $_GET['gid'];?>"/>
									<input type="submit" value="添加" />
								</td>
							</form>
						</tr>
					</tbody>
				</table>
			</div><!--/span-->
		</div><!--/row-->
		<!-- PAGE CONTENT ENDS HERE -->		  
	</div><!-- #main-content -->

	<a href="#" id="btn-scroll-up" class="btn btn-small btn-inverse">
		<i class="icon-double-angle-up icon-only"></i>
	</a>

	<!-- basic scripts -->
	
	<script src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/bootstrap.min.js"></script>
	<!-- page specific plugin scripts -->
	
	<!--[if lt IE 9]>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/excanvas.min.js"></script>
	<![endif]-->
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/jquery-ui-1.10.2.custom.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/jquery.ui.touch-punch.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/chosen.jquery.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/fuelux.spinner.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/bootstrap-datepicker.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/bootstrap-timepicker.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/date.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/daterangepicker.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/bootstrap-colorpicker.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/jquery.knob.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/jquery.autosize-min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/jquery.inputlimiter.1.3.1.min.js"></script>
	<script type="text/javascript" src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/jquery.maskedinput.min.js"></script>
	<!-- ace scripts -->
	<script src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/ace-elements.min.js"></script>
	<script src="http://localhost/qm_shop/./Qmshop/App/Admin/Tpl/Public/js/ace.min.js"></script>
	<!-- inline scripts related to this page -->
	
	<script type="text/javascript">
		$(function() {
			var flag = false;
			$('.edit-combine').click(function() {
				var trObj = $(this).parent().parent().find('td');
		        if(!flag){
		            trObj.find('input[type=text]').show();
		            trObj.find('span').hide();

		            $(this).removeClass('btn-success').addClass('btn-info').html("<i class='icon-check'> 保存</i>");
		            flag = true;
		        }else{
		           trObj.find('form').submit();
		        }
			});
			$('#id-disable-check').on('click', function() {
				var inp = $('#form-input-readonly').get(0);
				if(inp.hasAttribute('disabled')) {
					inp.setAttribute('readonly' , 'true');
					inp.removeAttribute('disabled');
					inp.value="This text field is readonly!";
				}
				else {
					inp.setAttribute('disabled' , 'disabled');
					inp.removeAttribute('readonly');
					inp.value="This text field is disabled!";
				}
			});


			$(".chzn-select").chosen(); 
			$(".chzn-select-deselect").chosen({allow_single_deselect:true}); 
			
			$('.ace-tooltip').tooltip();
			$('.ace-popover').popover();
			
			$('textarea[class*=autosize]').autosize({append: "\n"});
			$('textarea[class*=limited]').each(function() {
				var limit = parseInt($(this).attr('data-maxlength')) || 100;
				$(this).inputlimiter({
					"limit": limit,
					remText: '%n character%s remaining...',
					limitText: 'max allowed : %n.'
				});
			});
			
			$.mask.definitions['~']='[+-]';
			$('.input-mask-date').mask('99/99/9999');
			$('.input-mask-phone').mask('(999) 999-9999');
			$('.input-mask-eyescript').mask('~9.99 ~9.99 999');
			$(".input-mask-product").mask("a*-999-a999",{placeholder:" ",completed:function(){alert("You typed the following: "+this.val());}});
			
			
			
			$( "#input-size-slider" ).css('width','200px').slider({
				value:1,
				range: "min",
				min: 1,
				max: 6,
				step: 1,
				slide: function( event, ui ) {
					var sizing = ['', 'input-mini', 'input-small', 'input-medium', 'input-large', 'input-xlarge', 'input-xxlarge'];
					var val = parseInt(ui.value);
					$('#form-field-4').attr('class', sizing[val]).val('.'+sizing[val]);
				}
			});
			$( "#input-span-slider" ).slider({
				value:1,
				range: "min",
				min: 1,
				max: 11,
				step: 1,
				slide: function( event, ui ) {
					var val = parseInt(ui.value);
					$('#form-field-5').attr('class', 'span'+val).val('.span'+val).next().attr('class', 'span'+(12-val)).val('.span'+(12-val));
				}
			});
			
			
			var $tooltip = $("<div class='tooltip right in' style='display:none;'><div class='tooltip-arrow'></div><div class='tooltip-inner'></div></div>").appendTo('body');
			$( "#slider-range" ).css('height','200px').slider({
				orientation: "vertical",
				range: true,
				min: 0,
				max: 100,
				values: [ 17, 67 ],
				slide: function( event, ui ) {
					var val = ui.values[$(ui.handle).index()-1]+"";
					
					var pos = $(ui.handle).offset();
					$tooltip.show().children().eq(1).text(val);		
					$tooltip.css({top:pos.top - 10 , left:pos.left + 18});
					
					//$(this).find('a').eq(which).attr('data-original-title' , val).tooltip('show');
				}
			});
			$('#slider-range a').tooltip({placement:'right', trigger:'manual', animation:false}).blur(function(){
				$tooltip.hide();
				//$(this).tooltip('hide');
			});
			//$('#slider-range a').tooltip({placement:'right', animation:false});
			
			$( "#slider-range-max" ).slider({
				range: "max",
				min: 1,
				max: 10,
				value: 2,
				//slide: function( event, ui ) {
				//	$( "#amount" ).val( ui.value );
				//}
			});
			//$( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) );
			
			$( "#eq > span" ).css({width:'90%', float:'left', margin:'15px'}).each(function() {
				// read initial values from markup and remove that
				var value = parseInt( $( this ).text(), 10 );
				$( this ).empty().slider({
					value: value,
					range: "min",
					animate: true
					
				});
			});
			
			$('#id-input-file-1 , #id-input-file-2').ace_file_input({
				no_file:'No File ...',
				btn_choose:'Choose',
				btn_change:'Change',
				droppable:false,
				onchange:null,
				thumbnail:false //| true | large
				//whitelist:'gif|png|jpg|jpeg'
				//blacklist:'exe|php'
				//onchange:''
				//
			});
			
			$('#id-input-file-3').ace_file_input({
				style:'well',
				btn_choose:'Drop files here or click to choose',
				btn_change:null,
				no_icon:'icon-cloud-upload',
				droppable:true,
				onchange:null,
				thumbnail:'small',
				before_change:function(files, dropped) {
					/**
					if(files instanceof Array || (!!window.FileList && files instanceof FileList)) {
						//check each file and see if it is valid, if not return false or make a new array, add the valid files to it and return the array
						//note: if files have not been dropped, this does not change the internal value of the file input element, as it is set by the browser, and further file uploading and handling should be done via ajax, etc, otherwise all selected files will be sent to server
						//example:
						var result = []
						for(var i = 0; i < files.length; i++) {
							var file = files[i];
							if((/^image\//i).test(file.type) && file.size < 102400)
								result.push(file);
						}
						return result;
					}
					*/
					return true;
				}
				/*,
				before_remove : function() {
					return true;
				}*/
			}).on('change', function(){
				//console.log($(this).data('ace_input_files'));
				//console.log($(this).data('ace_input_method'));
			});
			
			$('#spinner1').ace_spinner({value:0,min:0,max:200,step:10, btn_up_class:'btn-info' , btn_down_class:'btn-info'})
			.on('change', function(){
				//alert(this.value)
			});
			$('#spinner2').ace_spinner({value:0,min:0,max:10000,step:100, icon_up:'icon-caret-up', icon_down:'icon-caret-down'});
			$('#spinner3').ace_spinner({value:0,min:-100,max:100,step:10, icon_up:'icon-plus', icon_down:'icon-minus', btn_up_class:'btn-success' , btn_down_class:'btn-danger'});
			
			/**
			var stubDataSource = {
			data: function (options, callback) {
				setTimeout(function () {
					callback({
						data: [
							{ name: 'Test Folder 1', type: 'folder', additionalParameters: { id: 'F1' } },
							{ name: 'Test Folder 1', type: 'folder', additionalParameters: { id: 'F2' } },
							{ name: 'Test Item 1', type: 'item', additionalParameters: { id: 'I1' } },
							{ name: 'Test Item 2', type: 'item', additionalParameters: { id: 'I2' } }
						]
					});
				}, 0);
			}
			};
			$('#MyTree').tree({ dataSource: stubDataSource , multiSelect:true })
			*/
			
			$('.date-picker').datepicker();
			$('#timepicker1').timepicker({
				minuteStep: 1,
				showSeconds: true,
				showMeridian: false
			});
			
			$('#id-date-range-picker-1').daterangepicker();
			
			$('#colorpicker1').colorpicker();
			$('#simple-colorpicker-1').ace_colorpicker();	
			$(".knob").knob();

		});
	</script>
</body>
</html>